﻿<UserControl x:Class="Zen4SyncDashboard.View.MergeSyncView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:converter="clr-namespace:Zen4SyncDashboard.Converter"
             mc:Ignorable="d" 
             d:DesignHeight="600" d:DesignWidth="794.2" Background="{DynamicResource ApplicationBackgroundBrush}">
    <UserControl.Resources>
        <converter:EncodedToStringConverter x:Key="EncodedStringConverter" />
        <ContextMenu x:Key="InternetContextMenu">
            <MenuItem Header="Delete selected Server" Command="{Binding DeleteCurrentInternetCommand}" Icon="{StaticResource Icon_Delete}" />
        </ContextMenu>
        <ContextMenu x:Key="PublisherContextMenu">
            <MenuItem Header="Delete selected Publisher" Command="{Binding DeleteCurrentPublisherCommand}" Icon="{StaticResource Icon_Delete}" />
        </ContextMenu>
        <ContextMenu x:Key="DistributorContextMenu">
            <MenuItem Header="Delete selected Distributor" Command="{Binding DeleteCurrentDistributorCommand}" Icon="{StaticResource Icon_Delete}" />
        </ContextMenu>
        <Style x:Key="MainListBoxStyle" TargetType="ListBox">
            <Setter Property="Margin" Value="0,10,10,10" />
        </Style>        
    </UserControl.Resources>
    <DockPanel x:Name="dockPanel" LastChildFill="True">
        <Label Content="Merge Synchronizations" Style="{StaticResource ViewTitle}" DockPanel.Dock="Top"/>
        <ScrollViewer DockPanel.Dock="Top">
            <StackPanel Margin="0,0,10,0">
                <Expander Header="Merge Synchronizations" IsExpanded="True">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="7*"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="3*"/>
                        </Grid.ColumnDefinitions>
                        <ListView ItemsSource="{Binding SyncSessions}">
                            <ListView.View>
                                <GridView>
                                    <GridViewColumn Header="Publication" DisplayMemberBinding="{Binding Path=syncSession_publication}"/>
                                    <GridViewColumn Header="Publication" DisplayMemberBinding="{Binding Path=syncSession_publication}"/>
                                    <GridViewColumn Header="Publisher" DisplayMemberBinding="{Binding Path=publisher.publisher_name}"/>
                                    <GridViewColumn Header="Distributor" DisplayMemberBinding="{Binding Path=distributor.distributor_name}"/>
                                    <GridViewColumn Header="IIS Server" DisplayMemberBinding="{Binding Path=internet.internet_name}"/>
                                    <GridViewColumn Header="Compression Lvl" DisplayMemberBinding="{Binding Path=syncSession_compressionLevel}"/>
                                </GridView>
                            </ListView.View>
                        </ListView>
                        <GridSplitter Grid.Column="1" VerticalAlignment="Stretch" Width="5"/>
                        <GroupBox Header="New" Grid.Column="2">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="4*"/>
                                    <ColumnDefinition Width="6*"/>
                                </Grid.ColumnDefinitions>
                                <Label Content="Publication" Grid.Column="0" Grid.Row="0"/>
                            	<Label Content="Hostname" Grid.Column="0" Grid.Row="1"/>
                                <Label Content="Compression Level" Grid.Column="0" Grid.Row="2"/>
                                <Label Content="Connect Timeout" Grid.Column="0" Grid.Row="3"/>
                                <Label Content="Connection Retry Timeout" Grid.Column="0" Grid.Row="4"/>
                                <Label Content="Login Timeout" Grid.Column="0" Grid.Row="5"/>
                                <Label Content="Query Timeout" Grid.Column="0" Grid.Row="6"/>
                                <Label Content="Send Timeout" Grid.Column="0" Grid.Row="7"/>
                                <Label Content="Receive Timeout" Grid.Column="0" Grid.Row="8"/>
                                <Label Content="Post Synchronization Cleanup" Grid.Column="0" Grid.Row="9"/>
                                <Label Content="Snapshot Transfer Type" Grid.Column="0" Grid.Row="10"/>
                                <Label Content="Exchange Type" Grid.Column="0" Grid.Row="11"/>
                                <Label Content="Publisher" Grid.Column="0" Grid.Row="12"/>
                                <Label Content="Distributor" Grid.Column="0" Grid.Row="13"/>
                                <Label Content="IIS Server" Grid.Column="0" Grid.Row="14"/>
                                <TextBox Style="{StaticResource NewTextBoxStyle}" Grid.Column="1" Grid.Row="0" Text="{Binding Path=NewSyncSession.syncSession_publication,ValidatesOnDataErrors=True}"/>
                                <TextBox Style="{StaticResource NewTextBoxStyle}" Grid.Column="1" Grid.Row="1" Text="{Binding Path=NewSyncSession.syncSession_hostName,ValidatesOnDataErrors=True}"/>
                                <TextBox Style="{StaticResource NewTextBoxStyle}" Grid.Column="1" Grid.Row="2" Text="{Binding Path=NewSyncSession.syncSession_compressionLevel,ValidatesOnDataErrors=True}"/>
                                <TextBox Style="{StaticResource NewTextBoxStyle}" Grid.Column="1" Grid.Row="3" Text="{Binding Path=NewSyncSession.syncSession_connectTimeout,ValidatesOnDataErrors=True}" />
                                <TextBox Style="{StaticResource NewTextBoxStyle}" Grid.Column="1" Grid.Row="4" Text="{Binding Path=NewSyncSession.syncSession_connectionRetryTimeout,ValidatesOnDataErrors=True}"/>
                                <TextBox Style="{StaticResource NewTextBoxStyle}" Grid.Column="1" Grid.Row="5" Text="{Binding Path=NewSyncSession.syncSession_loginTimeout,ValidatesOnDataErrors=True}"/>
                                <TextBox Style="{StaticResource NewTextBoxStyle}" Grid.Column="1" Grid.Row="6" Text="{Binding Path=NewSyncSession.syncSession_queryTimeout,ValidatesOnDataErrors=True}"/>
                                <TextBox Style="{StaticResource NewTextBoxStyle}" Grid.Column="1" Grid.Row="7" Text="{Binding Path=NewSyncSession.syncSession_sendTimeout,ValidatesOnDataErrors=True}"/>
                                <TextBox Style="{StaticResource NewTextBoxStyle}" Grid.Column="1" Grid.Row="8" Text="{Binding Path=NewSyncSession.syncSession_receiveTimeout,ValidatesOnDataErrors=True}"/>
                                <TextBox Style="{StaticResource NewTextBoxStyle}" Grid.Column="1" Grid.Row="9" Text="{Binding Path=NewSyncSession.syncSession_postSyncCleanup,ValidatesOnDataErrors=True}"/>
                                <ComboBox Grid.Column="1" Grid.Row="10" Style="{StaticResource NewComboBoxStyle}" ItemsSource="{Binding SnapshotTransferTypes, Mode=OneWay}" DisplayMemberPath="snapshotTransferType_name" SelectedItem="{Binding Path=NewSyncSession.snapshotTransferType, ValidatesOnDataErrors=True}"/>
                                <ComboBox Grid.Column="1" Grid.Row="11" Style="{StaticResource NewComboBoxStyle}" ItemsSource="{Binding ExchangeTypes, Mode=OneWay}" DisplayMemberPath="exchangeType_name" SelectedItem="{Binding Path=NewSyncSession.exchangeType, ValidatesOnDataErrors=True}"/>
                                <ComboBox Grid.Column="1" Grid.Row="12" Style="{StaticResource NewComboBoxStyle}" ItemsSource="{Binding Path=Publishers}" DisplayMemberPath="publisher_name" SelectedItem="{Binding Path=NewSyncSession.publisher, ValidatesOnDataErrors=True}"/>
                                <ComboBox Grid.Column="1" Grid.Row="13" Style="{StaticResource NewComboBoxStyle}" ItemsSource="{Binding Path=Distributors}" DisplayMemberPath="distributor_name" SelectedItem="{Binding Path=NewSyncSession.distributor, ValidatesOnDataErrors=True}"/>
                                <ComboBox Grid.Column="1" Grid.Row="14" Style="{StaticResource NewComboBoxStyle}" ItemsSource="{Binding Path=Internets}" DisplayMemberPath="internet_name" SelectedItem="{Binding Path=NewSyncSession.internet, ValidatesOnDataErrors=True}"/>
                                <Button Content="Add" Grid.Row="15" Grid.ColumnSpan="2" Style="{StaticResource AddButtonStyle}" Command="{Binding AddNewSyncSessionCommand}"/>
                            </Grid>
                        </GroupBox>
                    </Grid>
                </Expander>
                <Expander Header="IIS Servers">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="7*"/>
                            <ColumnDefinition Width="3*"/>
                        </Grid.ColumnDefinitions>
                        <ListBox ItemsSource="{Binding Internets}" SelectedItem="{Binding CurrentInternet}" ContextMenu="{StaticResource InternetContextMenu}" DisplayMemberPath="internet_name" Style="{StaticResource MainListBoxStyle}" />
                        <GroupBox Header="New" Grid.Column="1">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="4*"/>
                                    <ColumnDefinition Width="6*"/>
                                </Grid.ColumnDefinitions>
                                <Label Content="Name"/>
                                <Label Content="URL" Grid.Row="1"/>
                                <Label Content="Login" Grid.Row="2"/>
                                <Label Content="Password" Grid.Row="3"/>
                                <TextBox Style="{StaticResource NewTextBoxStyle}" Grid.Column="1" Grid.Row="1" Text="{Binding NewInternet.internet_url, ValidatesOnDataErrors=True}"/>
                                <TextBox Style="{StaticResource NewTextBoxStyle}" Grid.Column="1" Grid.Row="2" Text="{Binding NewInternet.internet_login}" IsEnabled="False"/>
                                <TextBox Style="{StaticResource NewTextBoxStyle}" Grid.Column="1" Grid.Row="3" Text="{Binding NewInternet.internet_password, Converter={StaticResource EncodedStringConverter}}" IsEnabled="False"/>
                                <TextBox Style="{StaticResource NewTextBoxStyle}" Grid.Column="1" Grid.Row="0" Text="{Binding NewInternet.internet_name, ValidatesOnDataErrors=True}"/>
                                <Button Content="Add" Style="{StaticResource AddButtonStyle}" Grid.Row="4" Grid.ColumnSpan="2" HorizontalContentAlignment="Center" Command="{Binding AddNewInternetCommand}"/>
                            </Grid>
                        </GroupBox>
                    </Grid>
                </Expander>
                <Expander Header="Publishers">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="7*"/>
                            <ColumnDefinition Width="3*"/>
                        </Grid.ColumnDefinitions>
                        <ListBox ContextMenu="{StaticResource PublisherContextMenu}" Style="{StaticResource MainListBoxStyle}" ItemsSource="{Binding Publishers}" DisplayMemberPath="publisher_name" SelectedItem="{Binding CurrentPublisher}"/>
                        <GroupBox Header="New" Grid.Column="1">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="4*"/>
                                    <ColumnDefinition Width="6*"/>
                                </Grid.ColumnDefinitions>
                                <Label Content="Name" />
                                <Label Content="Address" Grid.Row="1"/>
                                <Label Content="Database" Grid.Row="2"/>
                                <Label Content="Login" Grid.Row="3"/>
                                <Label Content="Password" Grid.Row="4"/>
                                <Label Content="Network Type" Grid.Row="5"/>
                                <Label Content="Security Mode" Grid.Row="6"/>
                                <TextBox Style="{StaticResource NewTextBoxStyle}" Grid.Column="1" Text="{Binding NewPublisher.publisher_name, ValidatesOnDataErrors=True}" />
                                <TextBox Style="{StaticResource NewTextBoxStyle}" Grid.Column="1" Grid.Row="1" Text="{Binding NewPublisher.publisher_address, ValidatesOnDataErrors=True}"/>
                                <TextBox  Style="{StaticResource NewTextBoxStyle}" Grid.Column="1" Grid.Row="2" Text="{Binding NewPublisher.publisher_database, ValidatesOnDataErrors=True}"/>
                                <TextBox Style="{StaticResource NewTextBoxStyle}" Grid.Column="1" Grid.Row="3" Text="{Binding NewPublisher.publisher_login}" IsEnabled="False"/>
                                <TextBox Style="{StaticResource NewTextBoxStyle}" Grid.Column="1" Grid.Row="4" Text="{Binding NewPublisher.publisher_password, Converter={StaticResource EncodedStringConverter}}" IsEnabled="False"/>
                                <ComboBox Style="{StaticResource NewComboBoxStyle}" Grid.Column="1" Grid.Row="5" ItemsSource="{Binding NetworkTypes}" DisplayMemberPath="networkType_name" SelectedItem="{Binding NewPublisher.networkType, ValidatesOnDataErrors=True}"/>
                                <ComboBox Style="{StaticResource NewComboBoxStyle}" Grid.Column="1" Grid.Row="6" ItemsSource="{Binding SecurityTypes}" DisplayMemberPath="securityType_name" SelectedItem="{Binding NewPublisher.securityType, ValidatesOnDataErrors=True}"/>
                                <Button Content="Add" Style="{StaticResource AddButtonStyle}" Grid.Row="7" Grid.ColumnSpan="2" HorizontalContentAlignment="Center" Command="{Binding AddNewPublisherCommand}"/>
                            </Grid>
                        </GroupBox>
                    </Grid>
                </Expander>
                <Expander Header="Distributors">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="7*"/>
                            <ColumnDefinition Width="3*"/>
                        </Grid.ColumnDefinitions>
                        <ListBox ContextMenu="{StaticResource DistributorContextMenu}" Style="{StaticResource MainListBoxStyle}" ItemsSource="{Binding Distributors}" DisplayMemberPath="distributor_name" SelectedItem="{Binding CurrentDistributor}"/>
                        <GroupBox Header="New" Grid.Column="1">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                    <RowDefinition/>
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="4*"/>
                                    <ColumnDefinition Width="6*"/>
                                </Grid.ColumnDefinitions>
                                <Label Content="Name" HorizontalAlignment="Left"/>
                                <Label Content="Address" HorizontalAlignment="Left" Grid.Row="1"/>
                                <Label Content="Login" HorizontalAlignment="Left" Grid.Row="2"/>
                                <Label Content="Password" HorizontalAlignment="Left" Grid.Row="3"/>
                                <Label Content="Profile Name" HorizontalAlignment="Left" Grid.Row="4"/>
                                <Label Content="Network Type" HorizontalAlignment="Left" Grid.Row="5"/>
                                <Label Content="Security Mode" HorizontalAlignment="Left" Grid.Row="6"/>
                                <TextBox Style="{StaticResource NewTextBoxStyle}" Grid.Column="1" Grid.Row="0" Text="{Binding NewDistributor.distributor_name, ValidatesOnDataErrors=True}"/>
                                <TextBox Style="{StaticResource NewTextBoxStyle}" Grid.Column="1" Grid.Row="1" Text="{Binding NewDistributor.distributor_address, ValidatesOnDataErrors=True}"/>
                                <TextBox Style="{StaticResource NewTextBoxStyle}" Grid.Column="1" Grid.Row="2" Text="{Binding NewDistributor.distributor_login}" IsEnabled="False"/>
                                <TextBox Style="{StaticResource NewTextBoxStyle}" Grid.Column="1" Grid.Row="3" Text="{Binding NewDistributor.distributor_password, Converter={StaticResource EncodedStringConverter}}" IsEnabled="False"/>
                                <TextBox Style="{StaticResource NewTextBoxStyle}" Grid.Column="1" Grid.Row="4" Text="{Binding NewDistributor.distributor_profileName, ValidatesOnDataErrors=True}"/>
                                <ComboBox Style="{StaticResource NewComboBoxStyle}" Grid.Column="1" Grid.Row="5" ItemsSource="{Binding NetworkTypes}" DisplayMemberPath="networkType_name" SelectedItem="{Binding NewDistributor.networkType, ValidatesOnDataErrors=True}"/>
                                <ComboBox Style="{StaticResource NewComboBoxStyle}" Grid.Column="1" Grid.Row="6" ItemsSource="{Binding SecurityTypes}" DisplayMemberPath="securityType_name" SelectedItem="{Binding NewDistributor.securityType, ValidatesOnDataErrors=True}"/>
                                <Button Content="Add" Style="{StaticResource AddButtonStyle}" Grid.ColumnSpan="2" Grid.Row="7" Command="{Binding AddNewDistributorCommand}"/>
                            </Grid>
                        </GroupBox>
                    </Grid>
                </Expander>
            </StackPanel>
        </ScrollViewer>
    </DockPanel>
</UserControl>
